﻿/*changeTexts(fl.getDocumentDOM());

function changeTexts(doc){	
	var typeToSearchFor = "text"; 
	var results = fl.findObjectInDocByType(typeToSearchFor, doc); 
	if (results.length > 0) { 
		for (var i = 0; i < results.length; i++) { 
			results[i].obj.setTextString("TestTest");
			results[i].obj.setTextAttr("face", "Arial");
		} 
		alert("success, found " + results.length + " objects");
	} 
	else {  
		alert("failed, no objects of type " + typeToSearchFor + " found"); 
	}
}*/

fl.outputPanel.clear();
scanLibrary(fl.getDocumentDOM().library);

function scanLibrary(library)
{
    var items = library.items;
    var item;	
  
    for( var i = 0; i < items.length; i++ )
    {
        item = items[i];
		if (item.itemType == 'movie clip') 
		{
			var timeline = item.timeline;
			var h = timeline.layerCount;
			
			library.selectItem(item);
			library.editItem();
			
			while(h--)
			{
				if(timeline.layers[h].layerType!="guide"){
					var k = timeline.layers[h].frameCount;
					
					while(k--)
					{
						var j = timeline.layers[h].frames[k].elements.length;
						
						while(j--){
							var elems = timeline.layers[h].frames[k].elements;
							var p = elems.length;
							
							while(p--)
							{
								if(elems[p].elementType == "text" && (elems[p].textType == "dynamic" || elems[p].textType == "input"))
								{
									elems[p].setTextString("");
									elems[p].setTextAttr("face", "Arial");
									elems[p].embedRanges = "";		
								}
							}						
						}
	
					}
				}
			}
		}
    }
}